package PPuente;

import java.sql.SQLException;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;

import modelos.MCategoria;
import modelos.MDB;

public class ListarCategoria extends MDB implements ImplementacionListar{
	
	
	@Override
	public void listar(Vector<MDB> v) {
	    String sql="SELECT * FROM Categoria WHERE estatus='A'";
	    abrir();
	    try {
	        rs = crearStatement().executeQuery(sql);
	        while (rs.next()){
	            MCategoria  i = new MCategoria();
	            i.setDescripcion(rs.getString("descripcion"));
	            i.setCodigo(rs.getInt("codigo"));
	            i.setEstatus(rs.getString("estatus"));
	            v.add(i);
	        }
	    } catch (SQLException ex) {
	        Logger.getLogger(MCategoria.class.getName()).log(Level.SEVERE, null, ex);
	    }	
	}
}
